import { createRouter, createWebHistory } from 'vue-router'
import Layout from '@/layout';

// 路由
export const constantRoutes = [
  {
    path: '/',
    component: Layout,
    redirect: '/index',
    children: [
      {
        path: '/index',
        name: 'index',
        component: () => import('@/views/index.vue'),
        hidden: false,
        meta: {
          title: '首页',
          icon: 'home-filled',
          cache: true
        }
      },
    ],
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('@/views/login/index'),
    hidden: true,
    meta: {
      title: '登录'
    },
  },
  {
    path: '/:pathMatch(.*)*',// 404
    name: 'not-found',
    hidden: true,
    component: () => import('@/views/NotFoundView.vue'),
  }
];

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: constantRoutes,
})

export default router
